package com.demo2do.fms.entity.supplier.common;

import com.demo2do.core.utils.Alias;

/**
 * 服务供方 公司类型
 * 
 * @author Wy
 *
 */
@Alias("SupplierType")
public enum Type {

    MOTOR("2", "motor", "运输" , "MOTOR"),
    
    STORAGE("1", "storage", "仓储", "STORAGE"),

    COMMON_STORAGE("3", "commonStorage", "一般仓储", "COMMON_STORAGE");
    
    private String code;

    private String alias;
    
    private String description;
    
    private String name;

    /**
     * @param code
     * @param alias
     * @param description
     * @param name
     */
	private Type(String code, String alias, String description, String name) {
		this.code = code;
		this.alias = alias;
		this.description = description;
		this.name = name;
	}

    /**
     * 
     * @param alias
     * @return
     */
    public static Type aliasOf(String alias){
        
        for(Type type : Type.values()){
            if(type.getAlias().equalsIgnoreCase(alias)){
                return type;
            }
        }
        
        return null;
    }
    
    /**
     * @return
     */
    public boolean isMotor() {
        return this.equals(MOTOR);
    }
    
    /**
     * @return
     */
    public boolean isStorage() {
        return this.equals(STORAGE);
    }

    /**
     *
     * @return
     */
    public boolean isCommonStorage() { return this.equals(COMMON_STORAGE);
    }

    /**
     * @return
     */
    public int getOrdinal() {
        return this.ordinal();
    }
    
    /**
     * @return the code
     */
    public String getCode() {
        return code;
    }

    /**
     * @return the alias
     */
    public String getAlias() {
        return alias;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

}